﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Nage.Algorithms.Population;
using Nage.Algorithms.Solution;

namespace Nage.Examples.Rastrigin.Solution
{
    public class RastriginFunctionEvaluator : ISolutionEvaluator<Coordinates>
    {
        public double Evaluate(Coordinates solution)
        {
            double value = 20;
            value += solution.X * solution.X + solution.Y * solution.Y;
            value -= 10 * (Math.Cos(2 * Math.PI * solution.X) + Math.Cos(2 * Math.PI * solution.Y));
            return value;
        }
    }
}
